import asyncio

# 使用 asyncio.create_task()（并发执行）
async def async_task1():
    await asyncio.sleep(1)
    return "Task 1 completed"

async def async_task2():
    await asyncio.sleep(2)
    return "Task 2 completed"

async def main():
    # 并发执行多个异步任务
    task1 = asyncio.create_task(async_task1())
    task2 = asyncio.create_task(async_task2())

    # 等待所有任务完成
    results = await asyncio.gather(task1, task2)
    print(results)  # ['Task 1 completed', 'Task 2 completed']

asyncio.run(main())